/*
 * Copyright 2007 Jeffrey Palm
 */

import java.lang.reflect.*;

abstract class TestSupport {

  public final void runTests() {
    try {
      runTests(getClass().getMethods());
      runTests(getClass().getDeclaredMethods());
    } catch (Exception e) {e.printStackTrace();}
  }

  private void runTests(Method[] ms) {
    for (Method m : ms) {
      m.setAccessible(true);
      String name = m.getName();
      if (m.getParameterTypes().length != 0 || !m.getName().startsWith("test")) continue;
      try {
        m.invoke(this,new Object[0]);
      } catch (Exception e) {e.printStackTrace();}
    }
  }
}